package controllers;

import java.text.SimpleDateFormat;
import java.util.Date;

import models.User;
import play.Routes;
import play.data.Form;
import play.mvc.*;
import play.mvc.Http.Response;
import play.mvc.Http.Session;
import play.*;
import play.data.*;
import play.data.validation.Constraints.*;

import views.html.*;


public class Classes extends Controller {

	
    public static class ClassesForm {
        @Required public String title;
		@Required public String description;
		@Required public String preRequisites;
		@Required public String price;        
    } 
	
	public static Result index() {
		return ok(classes.render(form(ClassesForm.class)));
	}
	

	public static Result test() {
		return ok("test is working");
	}

	public static Result schClasses() {
        Form<ClassesForm> form = form(ClassesForm.class).bindFromRequest();
        if(form.hasErrors()) {
            return badRequest(classes.render(form));
        } else {
            ClassesForm data = form.get();
            return ok(
                classesresult.render(data.title, data.description, data.preRequisites, data.price)
            );
        }
    }
	
}